Book Contents

Quick reference to security functions

These functions allow you to determine a user’s identity or security rights to limit access to the application based on these criteria. You might use these functions to control the visibility of graphic objects.

This function

Returns this value

CurrentUserName( )

A string containing the name of the current user.

This function is case sensitive. All RSView 3.20 and earlier user names use uppercase letters.

CurrentUserHasCode(SecurityCode)

1 (true) if any of the specified security codes have been assigned to the user; 0 (false) if not.

The argument can be a security code, tag name, or tag placeholder. If you use a tag name or tag placeholder, it must be enclosed in curly brackets ({}), for example, CurrentUserHasCode({#1}).

If checking multiple security codes, do not type a space between the security code letters.

For example, CurrentUserHasCode(ABP) returns the value 1 if the user has been assigned one or more of the specified codes.

CurrentUserHasGroup("Group Name")

1 (true) if the current user is assigned to the specified group configured in FactoryTalk Diagnostics; 0 (false) if not.

The argument can be a literal string, string tag, or tag placeholder. If you use a string, it must be enclosed in double quotes, for example, CurrentUserHasGroup ("UserGroupName1").

The argument can also be a combination of a literal string and string tag in the format of “Liter string” + String tag, for example, CurrentUserHasGroup ("UserGroupName1"+{[Controller]Main.UserGroupName}).

If CurrentUserHasGroup("Group C") returns the value 1, the user has been assigned to Group C.

This function is only supported in 8.0 and later versions of FactoryTalk ME applications.

Tip:

  • If you use a tag parameter for the CurrentUserHasCode() or the CurrentUserHasGroup () security function and create an 8.20 or earlier version runtime application (.mer) using current version FactoryTalk View:
    • The runtime application functions well.
    • When you restore the runtime application to 8.20 or earlier version design time application (.med) and create runtime application from the design time application in FactoryTalk View 8.20 or earlier, the security function does not work.
  • After you create a Windows-linked group on a domain computer and configure the group in FactoryTalk Directory, if you want to delete the group from the domain computer, and create a same-named Windows-linked group, you need do the following to ensure the CurrentUserHasGroup() security function returns consistent values on desktops and terminals:
    1. Delete the Windows-linked group from the domain computer and FactoryTalk Directory.
    2. Create a Windows-linked group on domain computer and assign the user(s) to the Windows-linked group.
    3. Configure the Windows-linked group in FactoryTalk Diagnostics.
  • On terminals, when removing a domain user from a specified group that is configured in FactoryTalk Directory, CurrentUserHasGroup() still returns TRUE until the user re-log in.

See also

About expressions

Quick reference to math functions

Quick reference to operators